﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/AdminSite.Master" AutoEventWireup="true" CodeBehind="QuanlySanpham.aspx.cs" Inherits="Web.Admin.QuanlySanpham" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">
    <div id="titleAdSP"><h4>Quản lý Danh sách sản phẩm</h4></div>
    <div id="bangDSSP"><asp:Panel ID="panelDSSP" runat="server">
        <div style="text-align:left; margin-left:10px;"><asp:LinkButton ID="btnThem" runat="server" CommandName="Insert" onclick="btnThem_Click">Thêm mới</asp:LinkButton></div>
        <asp:DataGrid ID="GridDSSP" runat="server" AllowPaging="True" 
            AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" Width="100%" 
            BorderColor="Silver" BorderWidth="1px" PageSize="5"
            onitemcommand="GridDSSP_ItemCommand" 
            onpageindexchanged="GridDSSP_PageIndexChanged"><AlternatingItemStyle BackColor="White" />
            <Columns>
                <asp:BoundColumn DataField="Ma_San_pham" HeaderText="Mã SP" ItemStyle-Width="45px">
                    <ItemStyle Width="45px" />
                </asp:BoundColumn>
                <asp:BoundColumn DataField="Ten_San_pham" HeaderText="Tên SP" ItemStyle-Width="100px">
                    <ItemStyle Width="100px" />
                </asp:BoundColumn>
                <asp:BoundColumn DataField="Chi_tiet" HeaderText="Chi Tiết" ItemStyle-Width="200px">
                    <ItemStyle Width="220px" />
                </asp:BoundColumn>
                <asp:TemplateColumn>
                    <HeaderTemplate>Hình Minh Họa</HeaderTemplate>
                    <ItemTemplate>
                        <asp:Image ID="Hinhminhhoa" runat="server" BorderStyle="Solid" BorderWidth="1px" BorderColor="Silver" Width="70px" Height="70px"
                            ImageUrl='<%# "../images/sanpham/" + Eval("Hinh_Minh_hoa").ToString() %>'/>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:BoundColumn DataField="Gia_ban" HeaderText="Giá Bán" ItemStyle-Width="80px">
                    <ItemStyle Width="80px" />
                </asp:BoundColumn>
                <asp:BoundColumn DataField="Ma_Phan_loai" HeaderText="Phân Loại" ItemStyle-Width="45px">
                    <ItemStyle Width="45px" />
                </asp:BoundColumn>
                <asp:TemplateColumn>
                    <HeaderTemplate>Thao tác</HeaderTemplate>
                    <ItemTemplate>
                        <asp:ImageButton ID="imgSua" runat="server" ImageUrl="~/Admin/images/edit.png" ToolTip="Sửa" CommandName="Edit" 
                            BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "Ma_San_pham") %>'/>&nbsp;|
                        <asp:ImageButton ID="imgXoa" runat="server" ImageUrl="~/Admin/images/cross.png" ToolTip="Xóa" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem, "Ma_San_pham") %>'
                            BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" OnClientClick="return confirm('Bạn có chắc chắn xóa?')" />
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
            <EditItemStyle BackColor="#2461BF" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="true" ForeColor="White" />
            <ItemStyle BackColor="#EFF3FB" />
            <PagerStyle BackColor="#F3F8FE"  ForeColor="Blue" HorizontalAlign="Center" Mode="NumericPages" />
            <SelectedItemStyle BackColor="#D1D0F1" Font-Bold="true" ForeColor="#333333" />
        </asp:DataGrid></asp:Panel>
    </div>

    <div id="ChitietSP">
        <asp:Panel ID="panelChitietsp" runat="server">
            <table style="border-style: solid; border-collapse:collapse; width:100%; border-color: #C0C0C0;" border="1" id="tblChitiet">
            <tr>
                <td colspan="2"></td>
                <td class="tieudecot"><asp:Label ID="Label6" runat="server" Text="Ngày nhập"></asp:Label></td>
                <td class="khungnhaplieu">
                    <asp:ScriptManager ID="ScriptManager" runat="server"></asp:ScriptManager>
                    <asp:TextBox ID="txtNgay" runat="server" CssClass="txtnhap" Enabled="False"></asp:TextBox>
                    <asp:Calendar ID="CalNgaynhap" runat="server" Format="dd/MM/yyyy" 
                        TargetControlID="txtNgay" PopupButtonID="btnNgay" FirstDayOfWeek="Monday" 
                        Font-Size="Small" ForeColor="#FF3300"></asp:Calendar>
                    <asp:ImageButton ID="btnNgay" runat="server" Height="18px" 
                        ImageUrl="~/Admin/images/calendar.png" Width="18px" onclick="btnNgay_Click" />
                </td>
            </tr>
            <tr>
                <td class="tieudecot"><asp:Label ID="Label1" runat="server" Text="Mã Sản Phẩm"></asp:Label></td>
                <td class="khungnhaplieu"><asp:TextBox ID="txtMaSP" runat="server" CssClass="txtnhap"></asp:TextBox></td>
                <td class="tieudecot"><asp:Label ID="Label4" runat="server" Text="Giá bán"></asp:Label></td>
                <td class="khungnhaplieu"><asp:TextBox ID="txtGia" runat="server" CssClass="txtnhap"></asp:TextBox></td>
            </tr>
            <tr>
                <td class="tieudecot"><asp:Label ID="Label2" runat="server" Text="Tên Sản Phẩm"></asp:Label></td>
                <td class="khungnhaplieu"><asp:TextBox ID="txtTenSP" runat="server" CssClass="txtnhap"></asp:TextBox></td>
                <td class="tieudecot"><asp:Label ID="Label5" runat="server" Text="Phân loại"></asp:Label></td>
                <td class="khungnhaplieu"><asp:DropDownList ID="lPhanloai" runat="server" CssClass="txtnhap">
                    <asp:ListItem></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="tieudecot"><asp:Label ID="Label3" runat="server" Text="Chi tiết"></asp:Label></td>
                <td colspan="3">
                    <asp:TextBox ID="txtChitiet" runat="server" CssClass="txtnhap" Width="475px" TextMode="MultiLine" Height="100px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="tieudecot">Ảnh Minh họa</td>
                <td class="khungnhaplieu">
                    <asp:Panel ID="pnHinh" runat="server" CssClass="khunghinh" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" Height="120px" Width="140px">
                        <asp:Image ID="imgHinh" runat="server" Width="140px" Height="120px"/>
                    </asp:Panel>  
                </td>
                <td colspan="2" style="text-align:left;" valign="top">
                    <input ID="fileImg" runat="server" name="file1" type="file" onclick="return fileImg_onclick()" /><br />
                    <asp:Button ID="btnOK" runat="server" Text="OK" onclick="btnOK_Click" /><br />
                    <asp:Label ID="lbLoi" runat="server" Font-Italic="True" 
                        Font-Size="Small" ForeColor="Red"></asp:Label>
                    <asp:Label ID="lbTenanh" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <asp:ImageButton ID="imgLuu" runat="server" ImageUrl="~/Admin/images/ok.ico" 
                        BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px" 
                        ToolTip="Lưu" Height="25px" Width="25px" BackColor="#6699FF" 
                        onclick="imgLuu_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:ImageButton ID="imgBack" runat="server" 
                        ImageUrl="~/Admin/images/back.png" BorderColor="#CCCCCC" 
                        BorderStyle="Solid" BorderWidth="1px" ToolTip="Trở ra" Height="25px" 
                        Width="25px" BackColor="#6699FF" onclick="imgBack_Click" />
                </td>
            </tr>
        </table>
        </asp:Panel>
    </div>
</asp:Content>
